<template>
  <div>
    <home-header></home-header>
    <home-swiper
      :list="swiperList">
    </home-swiper>
    <Icons
      :list="icosList">
    </Icons>
    <home-recommend
      :list="recommendList"
    ></home-recommend>
    <home-weekend
      :list="weekendList">
    </home-weekend>
    <home-footer>
    </home-footer>
  </div>
</template>

<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import Icons from './components/Icons'
import HomeRecommend from './components/Recommend'
import HomeWeekend from './components/Weekend'
import HomeFooter from './components/Footer'
import axios from 'axios'
export default {
  name: 'Home',
  data () {
    return {
      swiperList: [],
      weekendList: [],
      icosList: [],
      recommendList: []
    }
  },
  components: {
    HomeHeader,
    HomeSwiper,
    Icons,
    HomeRecommend,
    HomeWeekend,
    HomeFooter
  },
  methods: {
    getHomeData () {
      axios.get('/api/index.json')
        .then(this.getHomeDataSucc)
    },
    getHomeDataSucc (res) {
      res = res.data
      if (res.data) {
        const data = res.data
        this.swiperList = data.swiperList
        this.recommendList = data.recommendList
        this.weekendList = data.weekendList
        this.icosList = data.iconList
        console.log(this.icosList)
      }
    }
  },
  mounted () {
    this.getHomeData()
  }
}
</script>

<style>
</style>
